package com.xxxx.rpc.service;

import com.xxxx.api.service.ICheckCaptchaService;
import com.xxxx.api.pojo.ResultInfo;
import com.xxxx.api.utils.TCaptchaVerify;
import org.apache.dubbo.config.annotation.Service;

/**
 * @author nathan-wang on 2020-11-04
 */
@Service(version = "1.0")
public class CheckCaptchaServiceImpl implements ICheckCaptchaService {
    @Override
    public ResultInfo checkCaptcha(String ticket, String randstr) {
        int code = TCaptchaVerify.verifyTicket(ticket, randstr);
        ResultInfo resultInfo = new ResultInfo();
        if (code == 0) {
            resultInfo.setCode(200);
            resultInfo.setMsg("验证成功!");
        } else {
            resultInfo.setCode(500);
            resultInfo.setMsg("验证失败!");
        }
        return resultInfo;
    }
}
